{ Statement: http://informatics.mccme.ru/moodle/mod/statements/view3.php?chapterid=844
  Verdict: Accepted
}
uses
	SysUtils, Math;
 
var
	i, n : longint;
	a : array[0..2010] of longint;
 
begin
	reset(input,'input.txt');
	rewrite(output,'output.txt');
	read(n);
	a[0] := 1;
	a[1] := 1;
	a[2] := 2;
	i := 4;
	inc(n, 5);
	while i <= n do begin
		a[i] := a[i shr 1] + 1;
		a[i - 1] := a[i] + a[i shr 1 - 1];
		inc(i, 2);
	end;
	write(a[n - 5]);
end.